#!/bin/bash
# mogu-noRoi_V1.sh
# 检查是否存在nc命令
if ! command -v nc &> /dev/null; then
    echo "nc (netcat) command not found. Installing..."
    # 使用apt-get安装netcat
    sudo apt-get update
    sudo apt-get install -y netcat
else
    echo "nc (netcat) command is already installed."
fi



echo set_i_config motor galvo_mode 2|nc -nv 192.168.1.205 8001 -w1
echo set_i_config motor galvo_sync_enable 1|nc -nv 192.168.1.205 8001 -w1
echo set_i_config motor galvo_start_pos 5243|nc -nv 192.168.1.205 8001 -w1
sleep 1
echo set_i_config motor galvo_first_slope 568|nc -nv 192.168.1.205 8001 -w1
echo set_i_config motor galvo_first_period 5000|nc -nv 192.168.1.205 8001 -w1
sleep 1
echo set_i_config motor galvo_second_slope 218|nc -nv 192.168.1.205 8001 -w1
echo set_i_config motor galvo_second_period 0|nc -nv 192.168.1.205 8001 -w1
sleep 1
echo set_i_config motor galvo_third_slope 3985|nc -nv 192.168.1.205 8001 -w1
echo set_i_config motor galvo_third_period 0|nc -nv 192.168.1.205 8001 -w1
sleep 1
echo set_i_config motor galvo_fourth_slope 218|nc -nv 192.168.1.205 8001 -w1
echo set_i_config motor galvo_fourth_period 0|nc -nv 192.168.1.205 8001 -w1
sleep 1
echo set_i_config motor galvo_framerate 10|nc -nv 192.168.1.205 8001 -w1
echo set_i_config motor mtr_f_rpm 4800|nc -nv 192.168.1.205 8001 -w1
sleep 1
echo set_i_config motor galvo_fall_period 75|nc -nv 192.168.1.205 8001 -w1
echo set_i_config laser trig_rate 458|nc -nv 192.168.1.205 8001 -w1
sleep 1
echo set_i_config laser power_mw 1000|nc -nv 192.168.1.205 8001 -w1
echo set_i_config laser power_mw_low 500|nc -nv 192.168.1.205 8001 -w1
sleep 1
echo set_i_config manufacture reflectance_mode 2 |nc -nv 192.168.1.205 8001 -w1
sleep 1

echo "===== Finish setting. ====="